package com.example.root.getimei;


import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;


public class MainActivity extends AppCompatActivity {

    private TextView imeiTxt;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //        //构造函数中指定ACTION是Intent.ACTION_VIEW，即用于打开浏览器

//        Intent intent=new Intent(this,SecondActivity.class);
//        startActivity(intent);
//        imeiTxt = (TextView) findViewById(R.id.imei);
//
//        //获取TelephonyManager
//        TelephonyManager telephonyManager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
//        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
//            // TODO: Consider calling
//            //    ActivityCompat#requestPermissions
//            // here to request the missing permissions, and then overriding
//            //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
//            //                                          int[] grantResults)
//            // to handle the case where the user grants the permission. See the documentation
//            // for ActivityCompat#requestPermissions for more details.
//            return;
//        }
//        String imei = telephonyManager.getDeviceId();
//        imeiTxt.setText("imei:"+imei);
//        PhoneAccountHandle accountHandle;
//        telephonyManager.getVoicemailRingtoneUri(null);

    }

    public void startA(View view) {
//        Intent.ACTION_EDIT
        Intent intent = new Intent(Intent.ACTION_VIEW);
        //指定要打开的网址
        intent.setData(Uri.parse("http://www.baidu.com"));
        startActivity(intent);
    }
}
